by David Mann (2 Submissions)
Category: Coding Standards
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
This VERY simple Tutorial shows you how to disable / enable The Taskmanager.
First You need to add a new Module ad Copy / Paste this Code:
Option Explicit
Dim r As Long
Public Sub CreateKey(Folder As String, Value As String)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value
End Sub
Public Sub CreateIntegerKey(Folder As String, Value As Integer)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value, "REG_DWORD"
End Sub
Public Property Get ReadKey(Value As String) As String
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
r = b.RegRead(Value)
ReadKey = r
End Property
Public Sub DeleteKey(Value As String)
Dim b As Object
On Error Resume Next
Set b = CreateObject("Wscript.Shell")
b.RegDelete Value
End Sub
Now you can enable / diable the Taskmanager with one simple Line :
CreateIntegerKey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskmgr", "1"
1 = disabled and 0 = enabled .. hmm this is abit to complicated so lets make a function in your Module:
Public Function Disabletaskmanager()
CreateIntegerKey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskmgr", "1"
End Function
Public Function enabletaskmanager()
CreateIntegerKey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskmgr", "0"
End Function
TADA! you made 2 new "commands" enabletaskmanger and Disable Taskmanager !! Have Fun !